package xinxin.com.MementoPatternBasic.Originator;

import xinxin.com.MementoPatternBasic.Memento.Memento;

/**
 * @author ：史鑫鑫
 * @date ：Created in 2019/3/28 13:33
 * @describe ：发起人类
 */
public class Originator {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    // 创建备忘录
    public Memento CreateMemento() {
        return new Memento(state);
    }

    // 重置
    public void SetMemento(Memento memento) {
        state = memento.getState();
    }

    public void Show() {
        System.out.println("State=" + state);
    }
}
